(:
  A procedure to show the delta-t in minutes and seconds since the first intervention in the chat (clap)
:)
declare boundary-space strip;
import module namespace
    jj = "http://kumquat.emse.fr/utilitaires"
    at "jjutils.xq" ;

declare function local:get-time-milli ($item as element()) as xs:integer 
		{
			xs:integer($item/info[@name="time"]/time/date)
		};

<display>{
let $t := $arguments[1]
let $d := doc($t)/display/item
let $firstchat := $d[info[@name="type"]="drew-chat"][1]
let $firstchattime := local:get-time-milli($firstchat)
for $e at $p in $d
let $delta := jj:formatMMMSS(local:get-time-milli($e)-$firstchattime)
return 
<item>{
	<info name="timesinceclap">{$delta}</info>,
	for $info in $e/info
	return $info
}</item>
}</display>
